package columnEditors;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
 
@SuppressWarnings("serial")
public class ButtonRenderer extends JButton implements TableCellRenderer {
 
	public ButtonRenderer() {
		this.setOpaque(true);
//		this.setEnabled(false);
	}
  
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
    
		if (isSelected) {
			setForeground(table.getSelectionForeground());
			setBackground(table.getSelectionBackground());
			setBorder(BorderFactory.createLineBorder(Color.GRAY));
		} else{
			setBorder(BorderFactory.createEmptyBorder());
			setForeground(table.getForeground());
			setBackground(UIManager.getColor("Button.background"));
		}
       	
		setText( (value ==null) ? "" : value.toString() );
		
		return this;
	}
}
